package top.yxf.mcp.server.juejing.domain.service;

import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.stereotype.Service;
import top.yxf.mcp.server.juejing.domain.adapter.IJuejinPort;
import top.yxf.mcp.server.juejing.domain.model.ArticleFunctionRequest;
import top.yxf.mcp.server.juejing.domain.model.ArticleFunctionResponse;

@Slf4j
@Service
public class JueJinArticleService {

    @Resource
    private IJuejinPort port;

    @Tool(description = "发布文章到JueJin")
    public ArticleFunctionResponse saveArticle(ArticleFunctionRequest request) throws Exception {
        log.info("CSDN发帖，标题:{} 内容:{} 标签:{}", request.getTitle(), request.getMarkContent(), request.getTagIds());
        return port.writeArticle(request);
    }

}
